package cn.smxy.ln.controller;

import cn.smxy.ln.common.lang.Result;
import cn.smxy.ln.pojo.College;
import cn.smxy.ln.service.CollegeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ln
 * @date 2022年05月24日 19:53
 */
@RestController
@RequestMapping("/college/consumer")
public class CollegeController {

    @Autowired
    CollegeService collegeService;

    @GetMapping("/list")
    public Result queryAll() {
        return Result.succ(collegeService.queryAll());
    }

    @PostMapping("/save")
    public Result save(@RequestBody College college) {
        return Result.succ(collegeService.save(college));
    }

    @PostMapping("/delete")
    public Result delete(@RequestParam(value = "id") Long id) {
        return Result.succ(collegeService.delete(id));
    }

    @PostMapping("/update")
    public Result update(@RequestBody College college) {
        return Result.succ(collegeService.update(college));
    }
}
